import re, random, string
import requests
import json



count1 = int(input('请输入要创建新用户的个数(必须大于0)： '))
i = 0
passwds = []
while i < count1:
  tmp = random.sample(string.ascii_letters + string.digits, 8)
  passwd = ''.join(tmp)
  if re.search('[0-9]', passwd) and re.search('[A-Z]', passwd) and re.search('[a-z]', passwd):
    passwds.append(passwd)
    i += 1
print(passwds)



ip = "http://test-mars.dev-bp.atcloudbox.com"


def login():
    r = requests.post(ip+'/user/login', json={"login_type": 0, "login_info": {"device_id": passwd}})
    print(r.text)
    x_dog_token = r.json()["data"]["token"]
    return x_dog_token
    x_dog_tokens = []
    x_dog_tokens.append(x_dog_token)

for passwd in passwds:
    print(passwd)
    login()